package com.vdong.common.oauth.service.impl;

import com.baidu.disconf.client.common.annotations.DisconfFile;
import com.baidu.disconf.client.common.annotations.DisconfFileItem;
import com.baidu.disconf.client.common.update.IDisconfUpdate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
@DisconfFile(filename = "application.properties")
public class OauthDynamicPropertyService implements IDisconfUpdate {

    public OauthDynamicPropertyService() {
        System.out.println("OauthDynamicPropertyService");
    }

    //private static Logger log = LoggerFactory.getLogger(OauthDynamicPropertyService.class);

    @Value("token")
    private String token;

    @Value("appid")
    private String appid;

    @Value("secret")

    private String secret;

    @Value("key")
    private String key;

    @Value("h5Url")
    private String h5Url;

    @Value("backendDomain")
    private String backendDomain;

    @DisconfFileItem(name = "kpay.platform.token", associateField = "token")
    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    @DisconfFileItem(name = "kpay.platform.appid", associateField = "appid")
    public String getAppid() {
        return appid;
    }

    public void setAppid(String appid) {
        this.appid = appid;
    }

    @DisconfFileItem(name = "kpay.platform.secret", associateField = "secret")
    public String getSecret() {
        return secret;
    }

    public void setSecret(String secret) {
        this.secret = secret;
    }

    @DisconfFileItem(name = "kpay.platform.key", associateField = "key")
    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    @DisconfFileItem(name = "kpay.sys.setting.h5_login", associateField = "h5Url")
    public String getH5Url() {
        return h5Url;
    }

    public void setH5Url(String h5Url) {
        this.h5Url = h5Url;
    }

    @DisconfFileItem(name = "kpay.sys.setting.backend_domain", associateField = "backendDomain")
    public String getBackendDomain() {
        return backendDomain;
    }

    public void setBackendDomain(String backendDomain) {
        this.backendDomain = backendDomain;
    }

    @Override
    public void reload() throws Exception {
        //log.info("DisconfTestServiceImpl重新加载的信息为：" + toString());
    }
}
